package com.house.system.service.impl;

import java.util.List;

import com.house.common.annotation.DataScope;
import com.house.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.house.system.mapper.ReportMapper;
import com.house.system.domain.Report;
import com.house.system.service.IReportService;

/**
 * 用户报障对象Service业务层处理
 *
 * @author tc
 * @date 2022-02-25
 */
@Service
public class ReportServiceImpl implements IReportService {
    @Autowired
    private ReportMapper reportMapper;

    /**
     * 查询用户报障对象
     *
     * @param reportId 用户报障对象主键
     * @return 用户报障对象
     */
    @Override
    public Report selectReportByReportId(Long reportId) {
        return reportMapper.selectReportByReportId(reportId);
    }

    /**
     * 查询用户报障对象列表
     *
     * @param report 用户报障对象
     * @return 用户报障对象
     */
    @Override
    @DataScope(tableAlias = "r")
    public List<Report> selectReportList(Report report) {
        return reportMapper.selectReportList(report);
    }

    /**
     * 新增用户报障对象
     *
     * @param report 用户报障对象
     * @return 结果
     */
    @Override
    public int insertReport(Report report) {
        report.setCreateTime(DateUtils.getNowDate());
        report.setIsHandle("0");
        return reportMapper.insertReport(report);
    }

    /**
     * 修改用户报障对象
     *
     * @param report 用户报障对象
     * @return 结果
     */
    @Override
    public int updateReport(Report report) {
        report.setUpdateTime(DateUtils.getNowDate());
        return reportMapper.updateReport(report);
    }

    /**
     * 批量删除用户报障对象
     *
     * @param reportIds 需要删除的用户报障对象主键
     * @return 结果
     */
    @Override
    public int deleteReportByReportIds(Long[] reportIds) {
        return reportMapper.deleteReportByReportIds(reportIds);
    }

    /**
     * 删除用户报障对象信息
     *
     * @param reportId 用户报障对象主键
     * @return 结果
     */
    @Override
    public int deleteReportByReportId(Long reportId) {
        return reportMapper.deleteReportByReportId(reportId);
    }
}
